package com.zhidisoft.system.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

import org.hibernate.annotations.GenericGenerator;

/**
 * 字典类型实体
 * @author Lu Jianliang
 *
 */
@SuppressWarnings("all")
@Entity
@Table(name="tb_system_dict_type")
public class DictType implements Serializable{

	private String id;
	/**
	 * 字典类型名
	 */
	private String typeName;
	
	/**
	 * 字典类型编码
	 */
	private String typeCode;
	
	/**
	 * 备注
	 */
	private String typeNote;
	/**
	 * 记录创建时间
	 */
	private Date createTime;
	
	/**
	 * 记录创建者
	 */
	private User createUser;
	
	/**
	 * 记录更新时间
	 */
	private Date updateTime;
	
	/**
	 * 记录更新者
	 */
	private User updateUser;
	
	/**
	 * 记录状态
	 */
	private Integer status = 1;
	
	/**
	 * 排序数值，数值越大排序越靠前
	 */
	private Integer sortNum = 0;
	
	/**
	 * 版本控制值
	 */
	private Integer version;

	
	private Set<Dict> dicts = new HashSet<Dict>();
	
	@Id
	@GeneratedValue(generator="system-uuid")
	@GenericGenerator(name="system-uuid",strategy="uuid")
	public String getId() {
		return id;
	}


	@Column(length=50,nullable=false)
	public String getTypeName() {
		return typeName;
	}

	@Column(length=50,nullable=false,unique=true)
	public String getTypeCode() {
		return typeCode;
	}

	@Column(length=200)
	public String getTypeNote() {
		return typeNote;
	}
	
	
	@OneToMany(mappedBy="dictType")
	public Set<Dict> getDicts() {
		return dicts;
	}
	
	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreateTime() {
		return createTime;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="createBy")
	public User getCreateUser() {
		return createUser;
	}

	@Temporal(TemporalType.TIMESTAMP)
	public Date getUpdateTime() {
		return updateTime;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="updateBy")
	public User getUpdateUser() {
		return updateUser;
	}
	
	
	public Integer getStatus() {
		return status;
	}

	public Integer getSortNum() {
		return sortNum;
	}

	@Version
	public Integer getVersion() {
		return version;
	}

	public void setId(String id) {
		this.id = id;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public void setCreateUser(User createUser) {
		this.createUser = createUser;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public void setUpdateUser(User updateUser) {
		this.updateUser = updateUser;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public void setSortNum(Integer sortNum) {
		this.sortNum = sortNum;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public void setDicts(Set<Dict> dicts) {
		this.dicts = dicts;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public void setTypeCode(String typeCode) {
		this.typeCode = typeCode;
	}

	public void setTypeNote(String typeNote) {
		this.typeNote = typeNote;
	}
	
}
